<?php
	require ("classAdmin.php");
	$obj=new admin();
	$idLT=$_GET['idLT'];
	settype($idLT,"int");
	$subCat=$obj->DetailSubCat($idLT);
	$row_subCat=mysql_fetch_assoc($subCat);
	$Cat=$obj->Cat('',-1);
	if(isset($_POST['btnUpdate']))
	{	
		$obj->UpdateSubCat($idLT);
		header("location:ListSubCat.php");
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
#UpdateSubCat { margin:0px; padding:0px;}
form { width:600px; margin:40px auto;}
label{ float:left; clear:left; width:150px; padding-left:5px;}
legend{ font-size:16px; font-weight:bold; color:#222222; margin-bottom:5px;}
form div{ margin-bottom:10px;}
#btnSend{ margin:20px 0px 0px 150px;}
</style>	
</head>

<body>
	<div id="UpdateSubCat">
    	<form id="frmUpdateSubCat" method="post" action="">
        	<fieldset>
            	<legend>Chỉnh loại tin</legend>
                <div>
                	<label>Tên loại tin</label>
                    <input type="text" id="nameSubCat" name="nameSubCat" value="<?=$row_subCat['Ten']; ?>" />
                </div>
                <div>
                	<label>Thứ tự</label>
                    <input type="text" id="order" name="order" value="<?=$row_subCat['ThuTu']; ?>" />
                </div>
                <div>
                	<label>Ẩn hiện</label>
                    <input type="radio" id="0" value="0" name="active" <?=$row_subCat['AnHien']==0? "checked=checked":" " ?>/>Ẩn
                    <input type="radio" id="1" value="1" name="active" <?=$row_subCat['AnHien']==1? "checked=checked":" " ?> />Hiện
                </div>
                <div>
                	<label>Thể loại</label>
                    <select id="idTL" name="idTL">
                    <?php
					while($row_Cat=mysql_fetch_assoc($Cat)){
						$idTL=$row_Cat['idTL'];
						$TenTL=$row_Cat['TenTL'];
						$sec="";
						if($idTL == $row_subCat['idTL']) $sec="selected='selected'";
						echo "<option value={$idTL} {$sec}>{$TenTL}</option>"; 
					}
					?>
                    </select>
                </div>
                <div id="btnSend">
                    	<input type="reset" value="Reset"/>
                        <input type="submit" value="   OK " name="btnUpdate"/>                
                </div>
            </fieldset>
        </form>
    </div>
</body>
</html>